package com.ushio.gougouwangguo.task.config;

import com.ushio.gougouwangguo.entity.mysql.Resource;
import com.ushio.gougouwangguo.mapper.ResourceMapper;

import java.util.List;
import java.util.concurrent.Callable;

public class ResourceUpdateCallableTask implements Callable<List<Resource>> {


    private List<Resource> resources;
    private ResourceMapper resourceMapper;

    public ResourceUpdateCallableTask(List<Resource> resources, ResourceMapper resourceMapper) {
        this.resources = resources;
        // 通过构造器传
        this.resourceMapper = resourceMapper;
    }

    @Override
    public List<Resource> call() throws Exception {
        resourceMapper.updateById(resources);
        return resources;
    }
}
